home *** CD-ROM | disk | FTP | other *** search
/ The X-Philes (2nd Revision) / The X-Philes Number 1 (1995).iso / xphiles / hp48_1 / city.dis < prev    next >
Text File  |  1995-03-23  |  2KB  |  92 lines

  1. Article 2195 of comp.sys.handhelds:
  2. Path: en.ecn.purdue.edu!noose.ecn.purdue.edu!mentor.cc.purdue.edu!purdue!bu.edu!rpi!zaphod.mps.ohio-state.edu!wuarchive!cs.utexas.edu!uunet!mnemosyne.cs.du.edu!isis!ebergman
  3. From: ebergman@isis.cs.du.edu (Eric Bergman-Terrell)
  4. Newsgroups: comp.sys.handhelds
  5. Subject: Computing Great Circle Distance
  6. Message-ID: <1990Nov6.042632.16945@isis.cs.du.edu>
  7. Date: 6 Nov 90 04:26:32 GMT
  8. Reply-To: ebergman@isis.UUCP (Eric Bergman-Terrell)
  9. Organization: Math/CS, University of Denver
  10. Lines: 78
  11.  
  12. DIST for the HP 48SX:
  13.  
  14.  
  15. Introduction:
  16.  
  17. This program calculates the great circle distance in statute miles 
  18. between two cities, given their latitude and longitude in degrees, 
  19. minutes, and seconds format.
  20.  
  21.  
  22. Caveats:
  23.  
  24. No correction is made for the Earth's equatorial bulge.  USE THIS 
  25. SOFTWARE AT YOUR OWN RISK.
  26.  
  27.  
  28. Method:  
  29.  
  30. EXPRESS LATITUDES NORTH OF THE EQUATOR AS POSITIVE NUMBERS, AND
  31. LATITUDES SOUTH OF THE EQUATOR AS NEGATIVE NUMBERS.  EXPRESS 
  32. LONGITUDES WEST OF GREENWICH AS POSITIVE NUMBERS, AND LONGITUDES
  33. EAST OF GREENWICH AS NEGATIVE NUMBERS.
  34.  
  35. Convert the two latitudes and longitudes into spherical coordinate 
  36. unit vectors.  The smallest angle between the vectors is calculated 
  37. by taking the inverse cosine of the vectors' dot product.  
  38. Multiplying this angle by 60 yields the nautical miles between the 
  39. two cities.  Multiplying by 6080 and then dividing by 5280 yields 
  40. statute miles.
  41.  
  42.  
  43. Setup:
  44.  
  45. YOUR CALCULATOR MUST BE IN DEGREES MODE TO RUN THE PROGRAM.  To get
  46. into degrees mode, use the DEG command.
  47.  
  48.  
  49. Example:
  50.  
  51. Tokyo:    35d35'00" N 139d45'00" E
  52. Denver:    39d44'58" N 104d59'22" W
  53.  
  54. Entering the following:
  55.  
  56. 35.35
  57. -139.45
  58. 39.4422
  59. 104.5922
  60. DIST
  61.  
  62. leaves 5800 on the stack.  My almanac says that Denver is 5795
  63. statute miles from Tokyo.
  64.  
  65.  
  66. Program:
  67.  
  68. %%HP: T(3)A(R)F(.);
  69. \<< 0 0 \-> LATA LONA
  70. LATB LONB A B
  71.   \<< -15 SF -16 SF 1
  72. LONA HMS\-> 90 LATA
  73. HMS\-> - \->V3 'A' STO
  74. 1 LONB HMS\-> 90 LATB
  75. HMS\-> - \->V3 'B' STO
  76. A B DOT ACOS 60 *
  77. 6080 * 5280 / -15
  78. CF -16 CF
  79.   \>>
  80. \>>
  81.  
  82.  
  83. Size/Checksum:
  84.  
  85. 275 bytes
  86. # 11808d checksum
  87.  
  88.  
  89. Eric Bergman-Terrell
  90.  
  91.  
  92.